/*******************************************************************************
 * Copyright (c) 2000, 2005 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package edu.uts.reekie.designer.implementation.edit;

import org.eclipse.gef.*;
import org.eclipse.gef.commands.*;

import edu.uts.reekie.designer.*;
import edu.uts.reekie.designer.implementation.actions.*;
import edu.uts.reekie.designer.implementation.edit.*;
import edu.uts.reekie.designer.implementation.model.*;
import edu.uts.reekie.designer.actions.ToggleMultiplicityAction;
import edu.uts.reekie.designer.edit.*;
import edu.uts.reekie.designer.model.*;
import edu.uts.reekie.designer.model.commands.ToggleMultiplicityCommand;


public class ViewComponentEditPolicy
	extends ViewElementEditPolicy
{

public Command getCommand(Request request) {
	
	Object type = request.getType();
	/*
	if (SetUnsetComponentActiveStereotypeAction.getSetRequestName().equals(type)){
		return getSetUnsetStereotypeCommand(ViewComponentStereotype.ACTIVE,true);
	}
	if (SetUnsetComponentActiveStereotypeAction.getUnsetRequestName().equals(type)){
		return getSetUnsetStereotypeCommand(ViewComponentStereotype.ACTIVE,false);
	}
	
	if (SetUnsetComponentUserInitiatedStereotypeAction.getSetRequestName().equals(type)){
		return getSetUnsetStereotypeCommand(ViewComponentStereotype.USER_INITIATED,true);
	}
	if (SetUnsetComponentUserInitiatedStereotypeAction.getUnsetRequestName().equals(type)){
		return getSetUnsetStereotypeCommand(ViewComponentStereotype.USER_INITIATED,false);
	}
	
	if (SetUnsetComponentServiceStereotypeAction.getSetRequestName().equals(type)){
		return getSetUnsetStereotypeCommand(ViewComponentStereotype.SERVICE,true);
	}
	if (SetUnsetComponentServiceStereotypeAction.getUnsetRequestName().equals(type)){
		return getSetUnsetStereotypeCommand(ViewComponentStereotype.SERVICE,false);
	}
	*/
	if (ToggleMultiplicityAction.MULTIPLICITY.equals(type)){
		return getToggleMultiplicityCommand();
	}
	
	return super.getCommand(request);
}
protected Command getToggleMultiplicityCommand() {
	ToggleMultiplicityCommand cmd = new ToggleMultiplicityCommand();
	cmd.setTarget((Multiple)getHost().getModel());
	return cmd;
}



	
}
